package com.fishingwithme.infrastructure.utils;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/**
 * 腾讯地图地理编码API响应解析类（合并版）
 * 完整映射API返回的所有JSON字段
 */
public class GeocoderResponse {
    private int status;
    private String message;

    @JsonProperty("request_id")
    private String requestId;

    private Result result;

    // Getters and Setters
    public int getStatus() { return status; }
    public void setStatus(int status) { this.status = status; }
    public String getMessage() { return message; }
    public void setMessage(String message) { this.message = message; }
    public String getRequestId() { return requestId; }
    public void setRequestId(String requestId) { this.requestId = requestId; }
    public Result getResult() { return result; }
    public void setResult(Result result) { this.result = result; }


    /**
     * 结果核心数据
     */
    public static class Result {
        private Location location;
        private String address;

        @JsonProperty("poi_count")
        private int poiCount;

        private List<Poi> pois;

        @JsonProperty("address_component")
        private AddressComponent addressComponent;

        @JsonProperty("ad_info")
        private AdInfo adInfo;

        @JsonProperty("address_reference")
        private AddressReference addressReference;

        @JsonProperty("formatted_addresses")
        private FormattedAddresses formattedAddresses;

        // Getters and Setters
        public Location getLocation() { return location; }
        public void setLocation(Location location) { this.location = location; }
        public String getAddress() { return address; }
        public void setAddress(String address) { this.address = address; }
        public int getPoiCount() { return poiCount; }
        public void setPoiCount(int poiCount) { this.poiCount = poiCount; }
        public List<Poi> getPois() { return pois; }
        public void setPois(List<Poi> pois) { this.pois = pois; }
        public AddressComponent getAddressComponent() { return addressComponent; }
        public void setAddressComponent(AddressComponent addressComponent) { this.addressComponent = addressComponent; }
        public AdInfo getAdInfo() { return adInfo; }
        public void setAdInfo(AdInfo adInfo) { this.adInfo = adInfo; }
        public AddressReference getAddressReference() { return addressReference; }
        public void setAddressReference(AddressReference addressReference) { this.addressReference = addressReference; }
        public FormattedAddresses getFormattedAddresses() { return formattedAddresses; }
        public void setFormattedAddresses(FormattedAddresses formattedAddresses) { this.formattedAddresses = formattedAddresses; }
    }


    /**
     * 经纬度坐标
     */
    public static class Location {
        private double lat;  // 纬度
        private double lng;  // 经度

        // Getters and Setters
        public double getLat() { return lat; }
        public void setLat(double lat) { this.lat = lat; }
        public double getLng() { return lng; }
        public void setLng(double lng) { this.lng = lng; }
    }


    /**
     * 兴趣点(POI)信息
     */
    public static class Poi {
        private String id;
        private String title;
        private String address;
        private String category;
        private Location location;

        @JsonProperty("ad_info")
        private AdInfo adInfo;

        @JsonProperty("_distance")
        private double distance;

        @JsonProperty("_dir_desc")
        private String dirDesc;

        // Getters and Setters
        public String getId() { return id; }
        public void setId(String id) { this.id = id; }
        public String getTitle() { return title; }
        public void setTitle(String title) { this.title = title; }
        public String getAddress() { return address; }
        public void setAddress(String address) { this.address = address; }
        public String getCategory() { return category; }
        public void setCategory(String category) { this.category = category; }
        public Location getLocation() { return location; }
        public void setLocation(Location location) { this.location = location; }
        public AdInfo getAdInfo() { return adInfo; }
        public void setAdInfo(AdInfo adInfo) { this.adInfo = adInfo; }
        public double getDistance() { return distance; }
        public void setDistance(double distance) { this.distance = distance; }
        public String getDirDesc() { return dirDesc; }
        public void setDirDesc(String dirDesc) { this.dirDesc = dirDesc; }
    }


    /**
     * 地址组件
     */
    public static class AddressComponent {
        private String nation;      // 国家
        private String province;    // 省份
        private String city;        // 城市
        private String district;    // 区/县
        private String street;      // 街道
        private String street_number; // 门牌号

        // Getters and Setters
        public String getNation() { return nation; }
        public void setNation(String nation) { this.nation = nation; }
        public String getProvince() { return province; }
        public void setProvince(String province) { this.province = province; }
        public String getCity() { return city; }
        public void setCity(String city) { this.city = city; }
        public String getDistrict() { return district; }
        public void setDistrict(String district) { this.district = district; }
        public String getStreet() { return street; }
        public void setStreet(String street) { this.street = street; }
        public String getStreet_number() { return street_number; }
        public void setStreet_number(String street_number) { this.street_number = street_number; }
    }


    /**
     * 行政区划信息
     */
    public static class AdInfo {
        @JsonProperty("nation_code")
        private String nationCode;

        private String adcode;

        @JsonProperty("phone_area_code")
        private String phoneAreaCode;

        @JsonProperty("city_code")
        private String cityCode;

        private String name;
        private Location location;
        private String nation;
        private String province;
        private String city;
        private String district;

        @JsonProperty("_distance")
        private double distance;

        // Getters and Setters
        public String getNationCode() { return nationCode; }
        public void setNationCode(String nationCode) { this.nationCode = nationCode; }
        public String getAdcode() { return adcode; }
        public void setAdcode(String adcode) { this.adcode = adcode; }
        public String getPhoneAreaCode() { return phoneAreaCode; }
        public void setPhoneAreaCode(String phoneAreaCode) { this.phoneAreaCode = phoneAreaCode; }
        public String getCityCode() { return cityCode; }
        public void setCityCode(String cityCode) { this.cityCode = cityCode; }
        public String getName() { return name; }
        public void setName(String name) { this.name = name; }
        public Location getLocation() { return location; }
        public void setLocation(Location location) { this.location = location; }
        public String getNation() { return nation; }
        public void setNation(String nation) { this.nation = nation; }
        public String getProvince() { return province; }
        public void setProvince(String province) { this.province = province; }
        public String getCity() { return city; }
        public void setCity(String city) { this.city = city; }
        public String getDistrict() { return district; }
        public void setDistrict(String district) { this.district = district; }
        public double getDistance() { return distance; }
        public void setDistance(double distance) { this.distance = distance; }
    }


    /**
     * 地址参考信息
     */
    public static class AddressReference {
        private Town town;

        @JsonProperty("landmark_l2")
        private Landmark landmarkL2;

        private Street street;

        @JsonProperty("street_number")
        private StreetNumber streetNumber;

        private Crossroad crossroad;

        // Getters and Setters
        public Town getTown() { return town; }
        public void setTown(Town town) { this.town = town; }
        public Landmark getLandmarkL2() { return landmarkL2; }
        public void setLandmarkL2(Landmark landmarkL2) { this.landmarkL2 = landmarkL2; }
        public Street getStreet() { return street; }
        public void setStreet(Street street) { this.street = street; }
        public StreetNumber getStreetNumber() { return streetNumber; }
        public void setStreetNumber(StreetNumber streetNumber) { this.streetNumber = streetNumber; }
        public Crossroad getCrossroad() { return crossroad; }
        public void setCrossroad(Crossroad crossroad) { this.crossroad = crossroad; }
    }


    /**
     * 街道信息
     */
    public static class Street {
        private String id;
        private String title;
        private Location location;

        @JsonProperty("_distance")
        private double distance;

        @JsonProperty("_dir_desc")
        private String dirDesc;

        // Getters and Setters
        public String getId() { return id; }
        public void setId(String id) { this.id = id; }
        public String getTitle() { return title; }
        public void setTitle(String title) { this.title = title; }
        public Location getLocation() { return location; }
        public void setLocation(Location location) { this.location = location; }
        public double getDistance() { return distance; }
        public void setDistance(double distance) { this.distance = distance; }
        public String getDirDesc() { return dirDesc; }
        public void setDirDesc(String dirDesc) { this.dirDesc = dirDesc; }
    }


    /**
     * 街道门牌号
     */
    public static class StreetNumber {
        private String id;
        private String title;
        private Location location;

        @JsonProperty("_distance")
        private double distance;

        @JsonProperty("_dir_desc")
        private String dirDesc;

        // Getters and Setters
        public String getId() { return id; }
        public void setId(String id) { this.id = id; }
        public String getTitle() { return title; }
        public void setTitle(String title) { this.title = title; }
        public Location getLocation() { return location; }
        public void setLocation(Location location) { this.location = location; }
        public double getDistance() { return distance; }
        public void setDistance(double distance) { this.distance = distance; }
        public String getDirDesc() { return dirDesc; }
        public void setDirDesc(String dirDesc) { this.dirDesc = dirDesc; }
    }


    /**
     * 乡镇信息
     */
    public static class Town {
        private String id;
        private String title;
        private Location location;

        @JsonProperty("_distance")
        private double distance;

        @JsonProperty("_dir_desc")
        private String dirDesc;

        // Getters and Setters
        public String getId() { return id; }
        public void setId(String id) { this.id = id; }
        public String getTitle() { return title; }
        public void setTitle(String title) { this.title = title; }
        public Location getLocation() { return location; }
        public void setLocation(Location location) { this.location = location; }
        public double getDistance() { return distance; }
        public void setDistance(double distance) { this.distance = distance; }
        public String getDirDesc() { return dirDesc; }
        public void setDirDesc(String dirDesc) { this.dirDesc = dirDesc; }
    }


    /**
     * 地标信息
     */
    public static class Landmark {
        private String id;
        private String title;
        private Location location;

        @JsonProperty("_distance")
        private double distance;

        @JsonProperty("_dir_desc")
        private String dirDesc;

        // Getters and Setters
        public String getId() { return id; }
        public void setId(String id) { this.id = id; }
        public String getTitle() { return title; }
        public void setTitle(String title) { this.title = title; }
        public Location getLocation() { return location; }
        public void setLocation(Location location) { this.location = location; }
        public double getDistance() { return distance; }
        public void setDistance(double distance) { this.distance = distance; }
        public String getDirDesc() { return dirDesc; }
        public void setDirDesc(String dirDesc) { this.dirDesc = dirDesc; }
    }


    /**
     * 十字路口信息
     */
    public static class Crossroad {
        private String id;
        private String title;
        private Location location;

        @JsonProperty("_distance")
        private double distance;

        @JsonProperty("_dir_desc")
        private String dirDesc;

        // Getters and Setters
        public String getId() { return id; }
        public void setId(String id) { this.id = id; }
        public String getTitle() { return title; }
        public void setTitle(String title) { this.title = title; }
        public Location getLocation() { return location; }
        public void setLocation(Location location) { this.location = location; }
        public double getDistance() { return distance; }
        public void setDistance(double distance) { this.distance = distance; }
        public String getDirDesc() { return dirDesc; }
        public void setDirDesc(String dirDesc) { this.dirDesc = dirDesc; }
    }


    /**
     * 格式化地址信息
     */
    public static class FormattedAddresses {
        private String recommend;
        private String rough;
        private String standard_address;

        // Getters and Setters
        public String getRecommend() { return recommend; }
        public void setRecommend(String recommend) { this.recommend = recommend; }
        public String getRough() { return rough; }
        public void setRough(String rough) { this.rough = rough; }
        public String getStandard_address() { return standard_address; }
        public void setStandard_address(String standard_address) { this.standard_address = standard_address; }
    }
}
